package com.lz.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.lz.form.User;
import com.lz.util.SQLConfig;

public class UserDAO extends TheaDAO{
	
	public  User getUserDetails(String loginid,String password){
        
        User user=null;
        PreparedStatement ps=null;
        try{
              
            ps=conn.prepareStatement(SQLConfig.getQuery("GETUSER"));
            ps.setString(1,loginid);
            ps.setString(2,password);
            ResultSet rs=ps.executeQuery();
         
            while (rs.next()){
               user=new User();
               user.setLoginId(loginid);
               user.setPassword(password);
               user.setName(rs.getString("name"));
            }
            
            
        
        }
        catch(SQLException sqlex){
            sqlex.printStackTrace();
            throw new RuntimeException(sqlex);
        }
        finally{
            closeConnection();
        }
        
        return user;
	}
	
	
	
}
